#include <stdio.h>
#include <stdlib.h>


int add_all(int a)//累加
{
    if(a<2)return 1;
    return a+add_all(a-1);
}

int even(int a)//偶数
{
    if(a==0)
    {
        printf("\n");
        return 1;
    }
    
    if(a%2==0)printf("%d;",a);

    return even(a-1);
}

int frog(int a)//青蛙跳台阶
{
    if(a<=3)return a;
    return frog(a-1)+frog(a-2);
}

int factorial(int a)//阶乘
{
    if (a<=2)return a;
    return a*factorial(a-1);
}

int main(int argc, char const *argv[])
{
    int a = 100;
    printf("%d之内的数累加的结果为:%d\n",a,add_all(a));

    int b = 100;
    printf("%d以内的偶数有:",b);
    even(b);

    int c = 20;
    printf("青蛙一次只能跳一阶台阶或二阶台阶,现在有%d个台阶,它有%d个方法跳完这些台阶\n",c,frog(c));

    int d = 10;
    printf("%d的阶乘是:%d\n",d,factorial(d));
    
    return 0;
}
